<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="net.doglog.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>File List</title>
<link rel="stylesheet" type="text/css" href="/admin/style.css" />
</head>
<body>

<ul>
	<li><a href="/">Homepage</a></li>
	<li><a href="/admin">Dashboard</a></li>
	<li><a href="/admin/post">Post List</a></li>
</ul>
<h3>File List</h3>

<form action="/admin/file" method="post" enctype="multipart/form-data">

<fieldset>
	<legend>File Upload</legend>
	<input type="file" name="thefile" />
	<input type="submit" value="Upload" />
<% if (request.getAttribute("msg") != null) { %>
	<em><%= (String) request.getAttribute("msg") %></em>
<% } %>
</fieldset>

<fieldset>
	<legend>File List</legend>
<%
List<File> allFiles = FileUtil.getAllFiles();
if (allFiles.size() > 0) {
%>
	<table border="1" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>FileName</th>
			<th>ContentType</th>
			<th>LastModified</th>
		</tr>
	</thead>
	<tbody>
	<% for (File file : allFiles) { %>
		<tr>
			<td><%= file.getName() %></td>
			<td><%= file.getContentType() %></td>
			<td><%= new Date(file.getLastModified()) %></td>
		</tr>
	<% } %>
	</tbody>
	</table>
<%
} else {
	BlogUtil.printError(out, Blog.errorNoFileFound);
}
%>
</fieldset>

</form>

</body>
</html>